UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YgRdWuGnFUmnputSg+14QKkTWgZXW9cwexYMJwYxnBg=' 
WHERE 
  key_id = '80ff0146e538d1e889bdf8b9f9093155a019d76e67ff48da1984a8ce4c473b18' 
  AND (
    token = 'YgRdWuGnFUmnputSg+14QKkTWgZXW9cwexYMJwYxnBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049