UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bAkrw+Yi5EThafpBmxijuNgy2/koEZ+WAdiimzIh+Tc=' 
WHERE 
  key_id = '6021fb6422cf314ee62081fa552aad5a81806f5f2c9d7db4fd4dfbb7d9b7430f' 
  AND (
    token = 'bAkrw+Yi5EThafpBmxijuNgy2/koEZ+WAdiimzIh+Tc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040