UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Km2zVHYF0X5igmjvjyjAA5RZmbFpp+eb60cufNvu1mo='
WHERE
key_id = 'f84f761edf5c19a4a5f587cda82d1b5a7de6c97e86a0736b197ed787236e3f99'
AND (
token = 'Km2zVHYF0X5igmjvjyjAA5RZmbFpp+eb60cufNvu1mo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)