UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oOSq+oCKlny/pymESICczfWY4OoVlp2tdzpad4Vx+D0=' 
WHERE 
  key_id = '13c0f3531fcda8ce72d8fd5bb7b932cd9d8a1fb71b5f217076ddbd6cb763128b' 
  AND (
    token = 'oOSq+oCKlny/pymESICczfWY4OoVlp2tdzpad4Vx+D0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019