UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/tBbhm7A0q3ljpmmU2sFdcJpMJ+ivCenLZ+iPkQx+fI=' 
WHERE 
  key_id = '77e7e14ab47b7b6384d7366376ee249b30fcbcce8e429f833630490c602e8dcd' 
  AND (
    token = '/tBbhm7A0q3ljpmmU2sFdcJpMJ+ivCenLZ+iPkQx+fI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023