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