UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Jbkgj+SzDWZBBgQTP96/DkrGnLdobE6AxU6edrPRrM='
WHERE
key_id = 'c0dd93e93b3e07204a4512580645895b6b17961228a97e1b41e5a8b89582918f'
AND (
token = '6Jbkgj+SzDWZBBgQTP96/DkrGnLdobE6AxU6edrPRrM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)