UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Puy63/nl8K/S7vimgWkEy44NtVRQdZnYOtG7lyAbTpM='
WHERE
key_id = 'ca0b83b6232978b42065ac7cad8a713c8114f8051391832b403b32d6c8f29616'
AND (
token = 'Puy63/nl8K/S7vimgWkEy44NtVRQdZnYOtG7lyAbTpM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)