UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2H06QrLPpXO2TNG/uHNx3Fdy2+FDxQkp8dA6RYCmrzM=' 
WHERE 
  key_id = '774e8b69c0a8af128d1d05ca814fb39b1feb7cb5dd8d161e119d27edd9161e2e' 
  AND (
    token = '2H06QrLPpXO2TNG/uHNx3Fdy2+FDxQkp8dA6RYCmrzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027