UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWchwGfdae2/DKnnjYc8Y8eEKVGiVll1B6fyTpZfCyk='
WHERE
key_id = 'd8573703a0c0538f7cf54f786d6afd88bc6db8cbdc06eb442b97a136cab66e72'
AND (
token = 'KWchwGfdae2/DKnnjYc8Y8eEKVGiVll1B6fyTpZfCyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)