UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ycp0P30UAhnAZ4YsA1sArhHmDSyEdOUgzzMluOOBA2w='
WHERE
key_id = '1f9beaf17ac8dc717856cea30d68a8cc420c73c5493efc3f4d5922bc8efe0efd'
AND (
token = 'Ycp0P30UAhnAZ4YsA1sArhHmDSyEdOUgzzMluOOBA2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)