UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rfvq8GlZ+jPzoCaHJx9wJcS9IknX7WcrCNFucIQZQcQ=' 
WHERE 
  key_id = 'e4ed4a33c08852852a8be32a94f23f3095ad4c9de93dd3ba54d7937fada6614c' 
  AND (
    token = 'Rfvq8GlZ+jPzoCaHJx9wJcS9IknX7WcrCNFucIQZQcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032