UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NXQ52NV+G2ze0UOXfF8WOOMwxo42Yfbz8qgKDkzPnV4='
WHERE
key_id = 'ab5472607e0dbcec3ddf9c744d0361d85a8d8690e506fa7b6b1448f553068544'
AND (
token = 'NXQ52NV+G2ze0UOXfF8WOOMwxo42Yfbz8qgKDkzPnV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)