UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OXrKRlhqaqd7N55MGYyeg3iadEYJMbeGRQc+vHI7u/0=' 
WHERE 
  key_id = '10f06cfc22d2862916b715199c4e66cc145a7843dda2d8dc9223d304fa10c796' 
  AND (
    token = 'OXrKRlhqaqd7N55MGYyeg3iadEYJMbeGRQc+vHI7u/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030