UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PB2mESH1NI2LvCZROgqGuErdgGKCZRAO8LpegRayH/4=' 
WHERE 
  key_id = '07146a34c2a8e01906b886f88f836091d202a6f974e4c49efef5d7c1575117c6' 
  AND (
    token = 'PB2mESH1NI2LvCZROgqGuErdgGKCZRAO8LpegRayH/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023