UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3AIyE7v8LLCHrhGAWsdcPaXDSCH1eDKhw593xHlGpw=' 
WHERE 
  key_id = '828768089c696490de31e98139d89ced4010b83e2fd088155b08f072d9d722dc' 
  AND (
    token = 'q3AIyE7v8LLCHrhGAWsdcPaXDSCH1eDKhw593xHlGpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054