UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'emggDiQgLVdQSgeXeoD85WuEA9Gt15TLWvcT9aR+iog='
WHERE
key_id = 'f0a91fd217a2b72ed90df07463fdb405b07ad9751d13bfd8c3bf5649ecf029d8'
AND (
token = 'emggDiQgLVdQSgeXeoD85WuEA9Gt15TLWvcT9aR+iog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)