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