UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gab4e2mVNAzCAvN+n4T1lXwy3T1nqJfnLqh92YIzHSg=' 
WHERE 
  key_id = 'b0a598ec53542712d6561ce564131cc85884bf6b066dc93d007b921fad9c339b' 
  AND (
    token = 'gab4e2mVNAzCAvN+n4T1lXwy3T1nqJfnLqh92YIzHSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035