UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'koDcJRgjaTQ9HFxi3hw3vNcDw/MT9lJzxpNfrV0PedY='
WHERE
key_id = 'bd1003427b9ba5c7d4efe8c7a7d3b5505441739fda292899c14738741fc2e58b'
AND (
token = 'koDcJRgjaTQ9HFxi3hw3vNcDw/MT9lJzxpNfrV0PedY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)