UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tyLSDwMTu6HSTSqNX9ifv/dFRvbu0Zg6y4JZA6xsg1M=' 
WHERE 
  key_id = 'cddac3099e9776ebf8d1d8cb7b41d5852c853fecee88a197802743460139d15f' 
  AND (
    token = 'tyLSDwMTu6HSTSqNX9ifv/dFRvbu0Zg6y4JZA6xsg1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025