UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cG27DPrl+5yHk6wgTYi1CC36dRpUc9z0SpFIFiLZYOg='
WHERE
key_id = '34c4f5acb046e1b30161d4c9da180f8b3e812e177e4f074575f5fc39dc34e7e3'
AND (
token = 'cG27DPrl+5yHk6wgTYi1CC36dRpUc9z0SpFIFiLZYOg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)