UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EhLII1qh3iDIywpu9hP1FmmYjhiWjC0rwRJcQN9LE0w='
WHERE
key_id = '7f906c72f54bdc08dde37b0baa070ebb06b8da8beb895235381c269118a7788a'
AND (
token = 'EhLII1qh3iDIywpu9hP1FmmYjhiWjC0rwRJcQN9LE0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)