UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nNU03HUco3r6ncC/ccao86iJLzqyODhT9Lm93M+0Zv4=' 
WHERE 
  key_id = '2a7ba5e12be601d655bbd1bc928a213b2fd0c04d632c649fe96a961b1413901d' 
  AND (
    token = 'nNU03HUco3r6ncC/ccao86iJLzqyODhT9Lm93M+0Zv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037