UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'viLorQvKkEBBqpYJg1DjFQdZEDhI9PYhCYEnlSdYUpE='
WHERE
key_id = '0e3870c062a0d573f281a8dd98322203b5bce306d16b8f359ebbc512c5e66582'
AND (
token = 'viLorQvKkEBBqpYJg1DjFQdZEDhI9PYhCYEnlSdYUpE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)