UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lza1b7fRA25SqMtiBdFpiBLPBNFhKN3rOVeQvBHdTeo='
WHERE
key_id = 'd250e04c41b86cdbc0387f6416bba49dbbe71456a0927b7e664bbc263a872401'
AND (
token = 'lza1b7fRA25SqMtiBdFpiBLPBNFhKN3rOVeQvBHdTeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)