UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P1+De2x8irk4SBLeNwKKeWscIUoYjzdPpAPmWAuAt0U=' 
WHERE 
  key_id = 'acb6f5899031819b550b5cc9180cba04fd1c2138cb2de5ac2705189608f547c8' 
  AND (
    token = 'P1+De2x8irk4SBLeNwKKeWscIUoYjzdPpAPmWAuAt0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017