UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xecF2FRFk23Q3dNortVL1mLxyNzyTi5NRajFsJwNm+s=' 
WHERE 
  key_id = '9b16fbec2cf8e95ee7ff8df62037087766aa03be593d6c2c27d66a97ba45f066' 
  AND (
    token = 'xecF2FRFk23Q3dNortVL1mLxyNzyTi5NRajFsJwNm+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031