UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/vvGSZTuEwhsA+5kXXMdREGnIxxgxUzc4yplmYKg3U8=' 
WHERE 
  key_id = 'b9a07c92c29a59d9c80345174510226c1e02b2b3d968536bd59a1ef79422474d' 
  AND (
    token = '/vvGSZTuEwhsA+5kXXMdREGnIxxgxUzc4yplmYKg3U8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039