UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K+bZqKiJSdVjOowC9CVmMhG2+CDD9NTaUDj/9Ny19Dw=' 
WHERE 
  key_id = 'ccb02b248f4da6616562eff279c55f99c2a2d9ce2fc7cad8861c0d98e539253b' 
  AND (
    token = 'K+bZqKiJSdVjOowC9CVmMhG2+CDD9NTaUDj/9Ny19Dw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016